package com.sky.controller.user;

import com.fasterxml.jackson.core.JsonProcessingException;
import com.sky.dto.OrdersSubmitDTO;
import com.sky.result.Result;
import com.sky.service.OrderService;
import com.sky.vo.OrderSubmitVO;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * @author 韩先楚
 */
@RestController("orderusercontroller")
@RequestMapping("/user/order")
@Api(tags = "用户-订单")
@Slf4j
public class OrderController {


    @Autowired
    private OrderService orderService;
    /**
     * 用户移交订单
     */
    @PostMapping("/submit")
    @ApiOperation(value = "用户移交订单", notes = "用户移交订单")
    public Result<OrderSubmitVO> submit(@RequestBody OrdersSubmitDTO ordersSubmitDTO)
    {
        log.info("用户移交订单：{}", ordersSubmitDTO);
      OrderSubmitVO  ordersSubmitDTO1 = orderService.submit(ordersSubmitDTO);
        return Result.success(ordersSubmitDTO1);
    }

    /**
     * 客户催单
     */
    @GetMapping("/reminder/{id}")
    public Result  reminder(@PathVariable("id") Long id) throws JsonProcessingException {
        log.info("客户催单：{}", id);
        orderService.reminder(id);
        return Result.success();
    }

}
